home *** CD-ROM | disk | FTP | other *** search
- ///////////////////////////////////////////////////////////////////////////////
- // $Id: BasicCPU.hxx,v 1.1 1994/02/18 19:47:58 bmott Exp $
- ///////////////////////////////////////////////////////////////////////////////
- // BasicCPU.hxx
- //
- // This is the abstract base class for all microprocessors (CPU)
- //
- //
- // BSVC "A Microprocessor Simulation Framework"
- // Copyright (c) 1993
- // By: Bradford W. Mott
- // June 27,1993
- //
- ///////////////////////////////////////////////////////////////////////////////
- // $Log: BasicCPU.hxx,v $
- // Revision 1.1 1994/02/18 19:47:58 bmott
- // Initial revision
- //
- ///////////////////////////////////////////////////////////////////////////////
-
- #ifndef BASICCPU_HXX
- #define BASICCPU_HXX
-
- #include "String.h"
-
- class BasicCPU;
-
- #include "AddressSpace.hxx"
- #include "Event.hxx"
- #include "RegInfo.hxx"
- #include "StatInfo.hxx"
-
- class RegisterInformationList;
- class StatisticalInformationList;
-
- ///////////////////////////////////////////////////////////////////////////////
- // BasicCPU class declaration
- ///////////////////////////////////////////////////////////////////////////////
- class BasicCPU {
- private:
- // Name of the CPU
- const char *name;
-
- // Number of address spaces in the CPU
- const int number_of_address_spaces;
-
- // Granularity of the CPU in bytes
- const int granularity;
-
- // Record format returned from the ExecuteInstruction function
- const char *execution_trace_record;
-
- // Default fields of the trace record that should be displayed by UI
- const char *default_execution_trace_entries;
-
- public:
- // CPU's Event Handler
- EventHandler events;
-
- // Pointer to the array of address space objects
- AddressSpace *address_space;
-
- BasicCPU(const char* n, const int g, const int a,
- AddressSpace *addr, const char* trace,
- const char* default_trace)
- : name(n),
- granularity(g),
- number_of_address_spaces(a),
- address_space(addr),
- execution_trace_record(trace),
- default_execution_trace_entries(default_trace)
- {};
-
- // Return the name of the microprocessor
- inline const char *Name()
- { return(name); }
-
- // Return the granularity of the microprocessor
- inline int Granularity()
- { return(granularity); }
-
- // Return the number of address spaces used by the processor
- inline const int NumberOfAddressSpaces()
- { return(number_of_address_spaces); }
-
- // Return the execution trace record
- inline const char* ExecutionTraceRecord()
- { return(execution_trace_record); }
-
- // Return the default execution trace entries
- inline const char* DefaultExecutionTraceEntries()
- { return(default_execution_trace_entries); }
-
-
- // Execute the next instruction (NULL or pointer to error message)
- virtual const char* ExecuteInstruction(String& trace_record, int trace_flag)=0;
-
- // Handle an interrupt request from a device
- virtual void InterruptRequest(BasicDevice* device, int level)=0;
-
- // Perform a system reset
- virtual void Reset()=0;
-
- // Return the name of the program counter register (usually "PC")
- virtual char* const NameOfProgramCounter()=0;
-
- // Return the value of the program counter register
- virtual unsigned long ValueOfProgramCounter()=0;
-
- // Set the named register to the given hexidecimal value
- virtual void SetRegister(String name, String hex_value)=0;
-
- // Clear the CPU's Statistics
- virtual void ClearStatistics()=0;
-
- // Append all of the CPU's registers to the RegisterInformationList object
- virtual void BuildRegisterInformationList(RegisterInformationList*)=0;
-
- // Append all of the CPU's stats to the StatisticalInformationList object
- virtual void BuildStatisticalInformationList(StatisticalInformationList*)=0;
- };
- #endif
-
-